<template>
  <div class="i-menu">
    <div
      v-for="(item, index) in menus"
      :key="item.id"
      @click="handleChangeMenu(index, item.maitKey)"
      :class="['item', currentIndex === index ? 'active' : '']"
    >
      <span>
        {{ item.title }}
      </span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    menus: Array
  },
  data() {
    return {
      currentIndex: 0
    }
  },
  methods: {
    handleChangeMenu(index, maitKey) {
      this.currentIndex = index
      this.$emit('change', maitKey)
    }
  }
}
</script>

<style lang="less" scoped>
.i-menu {
  height: 100vh;
  overflow: scroll;
  width: 100px;
  text-align: center;
  font-size: 14px;
  .item {
    line-height: 40px;
    box-sizing: border-box;
  }
  .active > span {
    background: linear-gradient(to right, #00d6c1, var(--theme-color));
    padding: 5px 10px;
    border-radius: 20px;
    color: #ffffff;
  }
}
.i-menu::-webkit-scrollbar {
  width: 0;
}
</style>
